package com.healthcloud.controller;

import com.healthcloud.entity.testresult.BloodSugarTestResultEntity;
import com.healthcloud.service.testresult.BloodSugarTestResultService;
import com.healthcloud.utils.ApiRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 数据查询 控制器
 * by liujx 2019-08-27
 */
@Controller
@RequestMapping(value = "/query")
@Api(value = "数据查询外部接口", description = "数据查询外部接口")
public class QueryController {

    @Autowired
    private BloodSugarTestResultService bsTestResultService;

    @ApiOperation(value = "根据设备编号，列表查询血糖测试记录", notes = "根据设备编号，列表查询血糖测试记录")
    @RequestMapping(value = "/listBSTestResults", method = RequestMethod.GET)
    @ResponseBody
    public ApiRes listBSTestResults(BloodSugarTestResultEntity entity) {
        List<BloodSugarTestResultEntity> list = bsTestResultService.listBSTestResults(entity.getDevicesn());
        return new ApiRes(true, list, null, null);
    }

}